Skip to main content

ComponentTests

Horizontal Bar Chart With Axis – Component test plan

Sub-components: Bar, Callout, Labels, Legend

  1. Bar: Bar data, Bar color, bar label
  2. Callout: Default/custom callout
  3. Labels: Default/Custom labels
  4. Legend: show/hide legends, highlight the corresponding bars on legend hover
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, string data on y-axis.Should render horizontal bar chart with axis correctlyRTL
- With only data prop, numeric data on y-axis.Should render horizontal bar chart with axis correctlyRTL
- With showToolTipForYAxisLabels set to “true”Should show Y axis labels tooltip correctlyEnzyme
- With showYAxisLabels set to “true”Should show Y axis titles properlyEnzyme
Test 2: Basic props testing
- HideTooltip prop set to “true”Should not mount callout when hideTootip is trueEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
- With HideLegend prop set to “true”Should hide legendsEnzyme
- With HideLegend prop set to “false”Should display legendsEnzyme
- HideLabels prop set to “true”Should not render bar labels when hideLabels is trueRTL
Test 3: Render calling with respective to props
- No prop changes: Mount HorizontalBarChartWithAxis and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount HorizontalBarChartWithAxis chart and then set some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on a barShould render callout correctly on mouseoverEnzyme
- Mouse move from one bar to other barShould render callout correctly on mouse moveRTL
- Mouse over on a bar with customized calloutShould render customized callout on mouseoverRTL
Test 5: [Sub-Component]: Bar
- Specify bar colorShould render bar with the specified colorRTL
- With single colorShould render all the bars with same colorRTL
- setbarHeight to “x”Should render bars with specified heightRTL
Test 6: [Sub-Component]: Legend
- Hover mouse over bar legendsShould highlight the corresponding bar on mouse over on legendRTL
- Mouse leave on legendsShould reset the highlighted bar on mouse leave on legendsRTL
- Single mouse click on legendsShould select legend on single mouse click on respective legendRTL
- Double mouse click on legendsShould deselect legend on double mouse click on respective legendRTL
Test 7: [Sub-Component]: Callout
- Hover mouse over a barShould call the handler on mouse over barRTL
- Hover mouse over a bar to display calloutShould show the default callout over that barRTL
- Specify custom callout and hover mouse over a barShould show the custom callout over that barRTL
- Specify numeric axis data to display in calloutShould show the callout with axis data on itRTL
- Specify string yaxis data and numeric xaxis data to display it in calloutShould show the callout data based on axis dataRTL
Test 8: [Sub-Component]: Labels
- Set showYAxisLabelTooTip to “true” and mouse hover on Yaxis labelShould show y axis tooltip when mouse hover on itRTL
- Set showYAxisLabels to “true”Should show y axis labels data without truncatingRTL
Test 9: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 10: Theme changed to Dark ThemeShould reflect theme changeRTL